<!--
 * @Descripttion: (隐患台账数据项说明/Pro_hiddenmanage)
 * @version: (1.0)
 * @Author: (admin)
 * @Date: (2025-01-08)
 * @LastEditors: (admin)
 * @LastEditTime: (2025-01-08)
-->
<template>
  <div class="app-container">
    <!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
    <el-form :model="queryParams" size="small" label-position="right" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" 
      @submit.native.prevent>
      
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 工具区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary"  plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" :disabled="single"  plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" :disabled="multiple" v-hasPermi="['prohiddenmanage:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 数据区域 -->
    <el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @sort-change="sortChange" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="50" align="center"/>
      <el-table-column prop="uuid" label="Uuid" align="center" />
      <el-table-column prop="belongMine" label="煤矿编码" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="id" label="Id" align="center" />
      <el-table-column prop="examDate" label="检查日期" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="examMan" label="隐患检查人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="examUnit" label="隐患检查所属部门" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="riskPointId" label="风险点编码" align="center" />
      <el-table-column prop="hiddenType" label="隐患专业字" align="center">
        <template slot-scope="scope">
          <dict-tag :options="hiddenTypeOptions" :value="scope.row.hiddenType" />
        </template>
      </el-table-column>
      <el-table-column prop="hiddenLevel" label="隐患等级" align="center" />
      <el-table-column prop="problemDesc" label="隐患描述" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="dutyUnit" label="隐患责任单位" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="dutyMan" label="隐患责任人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="dealType" label="隐患整改方式" align="center">
        <template slot-scope="scope">
          <dict-tag :options="dealTypeOptions" :value="scope.row.dealType" />
        </template>
      </el-table-column>
      <el-table-column prop="limitDate" label="限期日期" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="hiddenSource" label="隐患来源" align="center" />
      <el-table-column prop="checkType" label="隐患检查类型" align="center">
        <template slot-scope="scope">
          <dict-tag :options="checkTypeOptions" :value="scope.row.checkType" />
        </template>
      </el-table-column>
      <el-table-column prop="activityName" label="活动名称" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="supUnit" label="隐患督办单位" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="supMan" label="隐患督办人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="shift" label="班次类型" align="center" />
      <el-table-column prop="isRelieve" label="是否接触" align="center">
        <template slot-scope="scope">
          <dict-tag :options="isRelieveOptions" :value="scope.row.isRelieve" />
        </template>
      </el-table-column>
      <el-table-column prop="isOverdue" label="是否发生过超期" align="center">
        <template slot-scope="scope">
          <dict-tag :options="isOverdueOptions" :value="scope.row.isOverdue" />
        </template>
      </el-table-column>
      <el-table-column prop="handleStatus" label="隐患处理状态" align="center">
        <template slot-scope="scope">
          <dict-tag :options="handleStatusOptions" :value="scope.row.handleStatus" />
        </template>
      </el-table-column>
      <el-table-column prop="modifyUnit" label="隐患整改单位" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="modifyMan" label="隐患整改人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="modifyDate" label="整改时间" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="modifyMeasures" label="整改结果" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="modifyCost" label="隐患治理所需资金" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="reviewUnit" label="隐患验收单位" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="reviewMan" label="隐患验收人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="reviewDate" label="验收时间" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="reviewReport" label="隐患验收结果" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="examImg" label="检查图片" align="center">
        <template slot-scope="scope">
          <el-image class="table-td-thumb" fit="contain" :src="scope.row.examImg" :preview-src-list="[scope.row.examImg]">
            <div slot="error"><i class="el-icon-document" /></div>
          </el-image>
        </template>
      </el-table-column>
      <el-table-column prop="modifyImg" label="整改图片" align="center">
        <template slot-scope="scope">
          <el-image class="table-td-thumb" fit="contain" :src="scope.row.modifyImg" :preview-src-list="[scope.row.modifyImg]">
            <div slot="error"><i class="el-icon-document" /></div>
          </el-image>
        </template>
      </el-table-column>
      <el-table-column prop="auditUnit" label="隐患审核人部门" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="auditMan" label="隐患审核人" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="auditDate" label="隐患审核日期" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="reviewOpinion" label="隐患审核意见" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="dataSource" label="隐患数据来源" align="center" />
      <el-table-column prop="modifyRequirement" label="隐患整改措施" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="createDate" label="隐患创建时间" align="center" :show-overflow-tooltip="true" />
      <el-table-column prop="updateDate" label="隐患编辑时间" align="center" :show-overflow-tooltip="true" />
     <el-table-column label="操作" align="center" width="140">
        <template slot-scope="scope">
          <el-button size="mini" v-hasPermi="['prohiddenmanage:edit']" type="success" icon="el-icon-edit" title="编辑" 
            @click="handleUpdate(scope.row)"></el-button>      
          <el-button size="mini" v-hasPermi="['prohiddenmanage:delete']" type="danger" icon="el-icon-delete" title="删除" 
            @click="handleDelete(scope.row)"></el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />

    <!-- 添加或修改隐患台账数据项说明对话框 -->
    <el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
      <el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
        <el-row :gutter="20">
           <el-col :lg="12">
            <el-form-item label="煤矿编码" prop="belongMine">
              <el-input v-model="form.belongMine" placeholder="请输入煤矿编码" />
            </el-form-item>
          </el-col>
          <el-col :lg="12">
            <el-form-item label="检查日期" prop="examDate">
              <el-date-picker v-model="form.examDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患检查人" prop="examMan">
              <el-input v-model="form.examMan" placeholder="请输入隐患检查人" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患检查所属部门" prop="examUnit">
              <el-input v-model="form.examUnit" placeholder="请输入隐患检查所属部门" />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="风险点编码" prop="riskPointId">
              <el-input v-model="form.riskPointId" placeholder="请输入风险点编码" />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患专业字" prop="hiddenType">
              <el-select v-model="form.hiddenType" placeholder="请选择隐患专业字">
                <el-option v-for="item in hiddenTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患等级" prop="hiddenLevel">
              <el-input v-model="form.hiddenLevel" placeholder="请输入隐患等级字典值" />
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="隐患描述" prop="problemDesc">
              <el-input type="textarea" v-model="form.problemDesc" placeholder="请输入隐患描述"/>
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="隐患责任单位" prop="dutyUnit">
              <el-input type="textarea" v-model="form.dutyUnit" placeholder="请输入隐患责任单位"/>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患责任人" prop="dutyMan">
              <el-input v-model="form.dutyMan" placeholder="请输入隐患责任人" />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患整改方式" prop="dealType">
              <el-select v-model="form.dealType" placeholder="请选择隐患整改方式">
                <el-option v-for="item in dealTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="限期日期" prop="limitDate">
              <el-date-picker v-model="form.limitDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="1 隐患来源" prop="hiddenSource">
              <el-input v-model="form.hiddenSource" placeholder="请输入1 隐患来源字典值" />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患检查类型" prop="checkType">
              <el-select v-model="form.checkType" placeholder="请选择隐患检查类型字典值">
                <el-option v-for="item in checkTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="活动名称" prop="activityName">
              <el-input v-model="form.activityName" placeholder="请输入活动名称" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患督办单位" prop="supUnit">
              <el-input v-model="form.supUnit" placeholder="请输入隐患督办单位" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患督办人" prop="supMan">
              <el-input v-model="form.supMan" placeholder="请输入隐患督办人" />
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="班次类型" prop="shift">
              <el-input v-model="form.shift" placeholder="请输入班次类型字典值" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="是否接触" prop="isRelieve">
              <el-radio-group v-model="form.isRelieve">
                <el-radio v-for="item in isRelieveOptions" :key="item.dictValue" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="是否发生过超期" prop="isOverdue">
              <el-radio-group v-model="form.isOverdue">
                <el-radio v-for="item in isOverdueOptions" :key="item.dictValue" :label="item.dictValue">{{item.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患处理状态" prop="handleStatus">
              <el-radio-group v-model="form.handleStatus">
                <el-radio v-for="item in handleStatusOptions" :key="item.dictValue" :label="parseInt(item.dictValue)">{{item.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患整改单位" prop="modifyUnit">
              <el-input v-model="form.modifyUnit" placeholder="请输入隐患整改单位" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患整改人" prop="modifyMan">
              <el-input v-model="form.modifyMan" placeholder="请输入隐患整改人" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="整改时间" prop="modifyDate">
              <el-date-picker v-model="form.modifyDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="整改结果" prop="modifyMeasures">
              <el-input type="textarea" v-model="form.modifyMeasures" placeholder="请输入整改结果"/>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患治理所需资金" prop="modifyCost">
              <el-input v-model="form.modifyCost" placeholder="请输入隐患治理所需资金" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患验收单位" prop="reviewUnit">
              <el-input v-model="form.reviewUnit" placeholder="请输入隐患验收单位" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患验收人" prop="reviewMan">
              <el-input v-model="form.reviewMan" placeholder="请输入隐患验收人" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="验收时间" prop="reviewDate">
              <el-date-picker v-model="form.reviewDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="隐患验收结果" prop="reviewReport">
              <el-input type="textarea" v-model="form.reviewReport" placeholder="请输入隐患验收结果"/>
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="检查图片" prop="examImg">
              <UploadImage v-model="form.examImg" column="examImg" @input="handleUploadSuccess" />
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="整改图片" prop="modifyImg">
              <UploadImage v-model="form.modifyImg" column="modifyImg" @input="handleUploadSuccess" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患审核人部门" prop="auditUnit">
              <el-input v-model="form.auditUnit" placeholder="请输入隐患审核人部门" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患审核人" prop="auditMan">
              <el-input v-model="form.auditMan" placeholder="请输入隐患审核人" />
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患审核日期" prop="auditDate">
              <el-date-picker v-model="form.auditDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="隐患审核意见" prop="reviewOpinion">
              <el-input type="textarea" v-model="form.reviewOpinion" placeholder="请输入隐患审核意见"/>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item label="隐患数据来源" prop="dataSource">
              <el-input v-model="form.dataSource" placeholder="请输入隐患数据来源字典值" />
            </el-form-item>
          </el-col>

          <el-col :lg="24">
            <el-form-item label="隐患整改措施" prop="modifyRequirement">
              <el-input type="textarea" v-model="form.modifyRequirement" placeholder="请输入隐患整改措施"/>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患创建时间" prop="createDate">
              <el-date-picker v-model="form.createDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item label="隐患编辑时间" prop="updateDate">
              <el-date-picker v-model="form.updateDate" type="datetime" placeholder="选择日期时间"></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="text" @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>
<script>
import { 
  listProHiddenmanage,
  addProHiddenmanage,
  delProHiddenmanage,
  updateProHiddenmanage,
  getProHiddenmanage,
} from '@/api/risk/proHiddenmanage.js';

export default {
  name: "prohiddenmanage",
  data() {
    return {
      labelWidth: "100px",
      formLabelWidth:"100px",
      // 选中uuid数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: false,
      // 显示搜索条件
      showSearch: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        sort: undefined,
        sortType: undefined,
      },
      // 弹出层标题
      title: "",
      // 操作类型 1、add 2、edit
      opertype: 0,
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      columns: [
        { index: 0, key: 'uuid', label: `Uuid`, checked:  true  },
        { index: 1, key: 'belongMine', label: `煤矿编码`, checked:  true  },
        { index: 2, key: 'id', label: `Id`, checked:  true  },
        { index: 3, key: 'examDate', label: `检查日期`, checked:  true  },
        { index: 4, key: 'examMan', label: `隐患检查人`, checked:  true  },
        { index: 5, key: 'examUnit', label: `隐患检查所属部门`, checked:  true  },
        { index: 6, key: 'riskPointId', label: `风险点编码`, checked:  true  },
        { index: 7, key: 'hiddenType', label: `隐患专业字`, checked:  true  },
        { index: 8, key: 'hiddenLevel', label: `隐患等级字典值`, checked:  true  },
        { index: 9, key: 'problemDesc', label: `隐患描述`, checked:  false  },
        { index: 10, key: 'dutyUnit', label: `隐患责任单位`, checked:  false  },
        { index: 11, key: 'dutyMan', label: `隐患责任人`, checked:  false  },
        { index: 12, key: 'dealType', label: `隐患整改方式`, checked:  false  },
        { index: 13, key: 'limitDate', label: `限期日期`, checked:  false  },
        { index: 14, key: 'hiddenSource', label: `1 隐患来源字典值`, checked:  false  },
        { index: 15, key: 'checkType', label: `隐患检查类型字典值`, checked:  false  },
        { index: 16, key: 'activityName', label: `活动名称`, checked:  false  },
        { index: 17, key: 'supUnit', label: `隐患督办单位`, checked:  false  },
        { index: 18, key: 'supMan', label: `隐患督办人`, checked:  false  },
        { index: 19, key: 'shift', label: `班次类型字典值`, checked:  false  },
        { index: 20, key: 'isRelieve', label: `是否接触 0 未解除;1已解除`, checked:  false  },
        { index: 21, key: 'isOverdue', label: `是否发生过超期(0未发生过超期;1 已发生过超期)`, checked:  false  },
        { index: 22, key: 'handleStatus', label: `隐患处理状态`, checked:  false  },
        { index: 23, key: 'modifyUnit', label: `隐患整改单位`, checked:  false  },
        { index: 24, key: 'modifyMan', label: `隐患整改人`, checked:  false  },
        { index: 25, key: 'modifyDate', label: `整改时间`, checked:  false  },
        { index: 26, key: 'modifyMeasures', label: `整改结果`, checked:  false  },
        { index: 27, key: 'modifyCost', label: `隐患治理所需资金`, checked:  false  },
        { index: 28, key: 'reviewUnit', label: `隐患验收单位`, checked:  false  },
        { index: 29, key: 'reviewMan', label: `隐患验收人`, checked:  false  },
        { index: 30, key: 'reviewDate', label: `验收时间`, checked:  false  },
        { index: 31, key: 'reviewReport', label: `隐患验收结果`, checked:  false  },
        { index: 32, key: 'examImg', label: `检查图片多个图片以“，”隔开`, checked:  false  },
        { index: 33, key: 'modifyImg', label: `整改图片多个图片以“，”隔开`, checked:  false  },
        { index: 34, key: 'auditUnit', label: `隐患审核人部门`, checked:  false  },
        { index: 35, key: 'auditMan', label: `隐患审核人`, checked:  false  },
        { index: 36, key: 'auditDate', label: `隐患审核日期`, checked:  false  },
        { index: 37, key: 'reviewOpinion', label: `隐患审核意见`, checked:  false  },
        { index: 38, key: 'dataSource', label: `隐患数据来源字典值`, checked:  false  },
        { index: 39, key: 'modifyRequirement', label: `隐患整改措施`, checked:  false  },
        { index: 40, key: 'createDate', label: `隐患创建时间`, checked:  false  },
        { index: 41, key: 'updateDate', label: `隐患编辑时间`, checked:  false  },
        { index: 42, key: 'isDelete', label: `是否删除 0正常;1删除`, checked:  false  },
        { index: 43, key: 'stateFlag', label: `数据操作标识字典值`, checked:  false  },
      ],
      // 隐患专业字选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      hiddenTypeOptions: [],
      // 隐患整改方式选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      dealTypeOptions: [],
      // 隐患检查类型字典值选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      checkTypeOptions: [],
      // 是否接触 0 未解除;1已解除选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      isRelieveOptions: [],
      // 是否发生过超期(0未发生过超期;1 已发生过超期)选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      isOverdueOptions: [],
      // 隐患处理状态选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      handleStatusOptions: [],
      // 是否删除 0正常;1删除选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      isDeleteOptions: [],
      // 数据操作标识字典值选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
      stateFlagOptions: [],
      // 数据列表
      dataList: [],
      // 总记录数
      total: 0,
      // 提交按钮是否显示
      btnSubmitVisible: true,
      // 表单校验
      rules: {
        uuid: [
          { required: true, message: "Uuid不能为空", trigger: "blur" }
        ],
      },
    };
  },
  created() {    
    // 列表数据查询
    this.getList();

    var dictParams = [
    ];
  },
  methods: {
    // 查询数据
    getList() {
      this.loading = true;
      listProHiddenmanage(this.queryParams).then(res => {
         if (res.code == 200) {
           this.dataList = res.data.result;
           this.total = res.data.totalNum;
           this.loading = false;
         }
       })
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 重置数据表单
    reset() {
      this.form = {
        uuid: undefined,
        belongMine: undefined,
        id: undefined,
        examDate: undefined,
        examMan: undefined,
        examUnit: undefined,
        riskPointId: undefined,
        hiddenType: undefined,
        hiddenLevel: undefined,
        problemDesc: undefined,
        dutyUnit: undefined,
        dutyMan: undefined,
        dealType: undefined,
        limitDate: undefined,
        hiddenSource: undefined,
        checkType: undefined,
        activityName: undefined,
        supUnit: undefined,
        supMan: undefined,
        shift: undefined,
        isRelieve: undefined,
        isOverdue: undefined,
        handleStatus: undefined,
        modifyUnit: undefined,
        modifyMan: undefined,
        modifyDate: undefined,
        modifyMeasures: undefined,
        modifyCost: undefined,
        reviewUnit: undefined,
        reviewMan: undefined,
        reviewDate: undefined,
        reviewReport: undefined,
        examImg: undefined,
        modifyImg: undefined,
        auditUnit: undefined,
        auditMan: undefined,
        auditDate: undefined,
        reviewOpinion: undefined,
        dataSource: undefined,
        modifyRequirement: undefined,
        createDate: undefined,
        updateDate: undefined,
        isDelete: undefined,
        stateFlag: undefined,
      };
      this.resetForm("form");
    },
    // 重置查询操作
    resetQuery() {
      this.timeRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.uuid);
      this.single = selection.length != 1
      this.multiple = !selection.length;
    },
     // 自定义排序
    sortChange(column) {
      if (column.prop == null || column.order == null) {
        this.queryParams.sort = undefined;
        this.queryParams.sortType = undefined;
      } else {
        this.queryParams.sort = column.prop;
        this.queryParams.sortType = column.order;
      }

      this.handleQuery();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加";
      this.opertype = 1;
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const Ids = row.uuid || this.ids;

      this.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项？')
        .then(function () {
          return delProHiddenmanage(Ids);
        })
        .then(() => {
          this.handleQuery();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.uuid || this.ids;
      getProHiddenmanage(id).then((res) => {
        const { code, data } = res;
        if (code == 200) {
          this.open = true;
          this.title = "修改数据";
          this.opertype = 2;

          this.form = {
            ...data,
          };
        }
      });
    },
    //图片上传成功方法
    handleUploadSuccess(column, filelist) {
      this.form[column] = filelist;
    },
    // 隐患专业字字典翻译
    hiddenTypeFormat(row, column) {
      return this.selectDictLabel(this.hiddenTypeOptions, row.hiddenType);
    },
    // 隐患整改方式字典翻译
    dealTypeFormat(row, column) {
      return this.selectDictLabel(this.dealTypeOptions, row.dealType);
    },
    // 隐患检查类型字典值字典翻译
    checkTypeFormat(row, column) {
      return this.selectDictLabel(this.checkTypeOptions, row.checkType);
    },
    // 是否接触 0 未解除;1已解除字典翻译
    isRelieveFormat(row, column) {
      return this.selectDictLabel(this.isRelieveOptions, row.isRelieve);
    },
    // 是否发生过超期(0未发生过超期;1 已发生过超期)字典翻译
    isOverdueFormat(row, column) {
      return this.selectDictLabel(this.isOverdueOptions, row.isOverdue);
    },
    // 隐患处理状态字典翻译
    handleStatusFormat(row, column) {
      return this.selectDictLabel(this.handleStatusOptions, row.handleStatus);
    },
    // 是否删除 0正常;1删除字典翻译
    isDeleteFormat(row, column) {
      return this.selectDictLabel(this.isDeleteOptions, row.isDelete);
    },
    // 数据操作标识字典值字典翻译
    stateFlagFormat(row, column) {
      return this.selectDictLabel(this.stateFlagOptions, row.stateFlag);
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          console.log(JSON.stringify(this.form));
          
          if (this.form.uuid != undefined && this.opertype === 2) {
            updateProHiddenmanage(this.form)
              .then((res) => {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
            })
            .catch((err) => {
                //TODO 错误逻辑
              });
          } else {
            addProHiddenmanage(this.form)
              .then((res) => {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
            })
            .catch((err) => {
                //TODO 错误逻辑
              });
          }
        }
      });
    },
  },
};
</script>